import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter_app/util/config.dart';
import 'package:flutter_page_indicator/flutter_page_indicator.dart';

class TstSwiper extends StatefulWidget {
  @override
  _MySwiperHomeSate createState() => _MySwiperHomeSate();
// TODO: implement createState

}

class _MySwiperHomeSate extends State<TstSwiper> {
  var listData = [
    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561701368792&di=e9ab8026cbb2e098f7a2b915f7bc9bda&imgtype=0&src=http%3A%2F%2Fpicapi.zhituad.com%2Fphoto%2F02%2F90%2F42EBE.jpg',
    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561701368791&di=742e9301356d4f32e7e22701d45a7292&imgtype=0&src=http%3A%2F%2Fpicapi.zhituad.com%2Fphoto%2F30%2F50%2F63ADD.jpg',
    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561701368790&di=5681d29b6b802837e175dc7e7bd8680d&imgtype=0&src=http%3A%2F%2Fpicapi.zhituad.com%2Fphoto%2F66%2F41%2F07EDC.jpg'
  ];

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Swiper'),
      ),
      body: ListView(
        children: <Widget>[
          Container(
            height: 160,
            child: Swiper(
              itemBuilder: (BuildContext context, int index) {
                return new Image.network(
                  listData[index],
                  fit: BoxFit.fill,
                );
              },
              //indicatorLayout: PageIndicatorLayout.COLOR,
              autoplay: true,
              itemCount: images.length,
              pagination: new SwiperPagination(),
              //control: new SwiperControl(),
            ),
          ),
          Container(
            padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
            height: 160,
            child: Swiper(
              itemBuilder: (BuildContext context, int index) {
                return new Image.network(
                  listData[index],
                  fit: BoxFit.fill,
                );
              },
              //indicatorLayout: PageIndicatorLayout.COLOR,
              autoplay: true,
              itemCount: images.length,
              pagination: new SwiperPagination(),
              control: new SwiperControl(),
            ),
          ),
          Container(
              padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
              height: 160,
              child: Swiper(
                itemBuilder: (BuildContext context, int index) {
                  return new Image.network(
                    listData[index],
                    fit: BoxFit.fill,
                  );
                },
                //indicatorLayout: PageIndicatorLayout.COLOR,
                autoplay: true,
                itemCount: images.length,
                control: new SwiperControl(),
                //pagination: new SwiperPagination(),

                 pagination: new SwiperPagination(builder: SwiperPagination.fraction),
              )
          ),
        ],
      ),
    );
  }
}
